package com.linkoog.devtools.dubbo.toolwindow.workbenche.left.tree;

import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;

import java.awt.*;

import static javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION;

public class DubboHistoryTree extends JTree {

    private Project project;

    public DubboHistoryTree(@NotNull Project project){
        this.project = project;
        initDubboHistoryTree();
    }

    private void initDubboHistoryTree(){
        this.expandRow(0);
        this.setRootVisible(false);
        this.getSelectionModel().setSelectionMode(SINGLE_TREE_SELECTION);
        //this.setCellRenderer(new DefaultTreeCellRenderer());


        DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
        DefaultTreeModel model = new DefaultTreeModel(rootNode);
        setModel(model);
    }

}
